﻿using Microsoft.SharePoint;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kaskelot.SP.Core;

namespace Kaskelot.SP.Services.Setup
{
    public class PersonWebSetup : IWebSetup
    {
        public void Setup(SPWeb web)
        {
            web.Features.Reactivate(Constants.Features.PersonPages);

			var v = new List<Model.Client.Tab> 
            {
                new Model.Client.Tab { TabIndex = 1, Title = "Grundinformation"},
                new Model.Client.Tab { TabIndex = 2, Title = "Uppdrag"},
                new Model.Client.Tab { TabIndex = 3, Title = "Ansökan"},
				new Model.Client.Tab { TabIndex = 4, Title = "Kurser"}
            };

			if(web.AllProperties.ContainsKey(Constants.Tabs.TabConfiguration))
				web.AllProperties.Remove(Constants.Tabs.TabConfiguration);

			web.AllProperties.Add(Constants.Tabs.TabConfiguration, Precio.SharePoint.Core.XmlSerializer<List<Model.Client.Tab>>.Serialize(v));
			web.Update();
        }
    }
}
